<?php
$tm = $_GET['tm'];
$da = json_decode($tm,true);
$data=array('csm'=>"📍我的直男小瓶子",'dfjs'=>"直男指数：",'df'=>null,'bq1' =>"暖男",'bq2'=>"铁憨憨",'bq3'=>"敷衍级别",'bq4'=>"耐心程度",bq5=>"注孤身","bq6"=>null,'pf1' =>2,'pf2'=>3,'pf3'=>4,'pf4'=>2,'pf5'=>3);
$df = 0;
for($i=0; $i<4; $i++){
   switch ($i){
       case 0: switch($da[0])
                    {case A: $df=25; $data[pf1]=2;break;
                     case B: $df=1; $data[pf1]=5;$data[pf5]=1;break;
                     case C: $df=15; $data[pf1]=1;break;
                     }break;
       case 1:switch($da[1])
                    {case A: $df=$df+25; $data[pf2]=5;$data[pf5]=5;break;
                     case B: $df=$df+15; $data[pf2]=3;break;
                     case C: $df=$df+0; $data[pf2]=1;break;
                     }break;
       case 2:switch($da[2])
                    {case A: $df=$df+25;  $data[pf3]=5; break;
                     case B: $df=$df+25;  $data[pf3]=3;break;
                     case C: $df=$df+0;  $data[pf3]=1;$data[pf5]=1;break;
                     }break;
       case 3:switch($da[3])
                    {case A: $df=$df+0; $data[pf4]=5;break;
                     case B: $df=$df+15; $data[pf4]=2;break;
                     case C: $df=$df+25; $data[pf4]=1;$data[pf5]=4;break;
                     }break;
   }
}
if($df>=50){
	$data[pf1]=1;
}
$data[df]=$df.'%';
echo json_encode($data,JSON_UNESCAPED_UNICODE);
$conn = new mysqli('127.0.0.1', '3h74cu729i222', 'gm666946','3h74cu729i222');
$conn ->set_charset("utf8");
$sql = "SELECT * FROM sjtj WHERE num = 0";
$res=$conn->query($sql);
$data=$res->fetch_all();
$sccs=$data[0][5]+1;
$sql = "UPDATE sjtj SET xpzcscs = '$sccs' WHERE num = 0";
$res=$conn->query($sql);
$conn->close();
?>